package org.nobody.mallb2c.mallmember.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nobody.common.utils.PageUtils;
import org.nobody.common.utils.Query;

import org.nobody.mallb2c.mallmember.dao.MemberReceiveAddressDao;
import org.nobody.mallb2c.mallmember.entity.MemberReceiveAddressEntity;
import org.nobody.mallb2c.mallmember.service.MemberReceiveAddressService;


@Service("memberReceiveAddressService")
public class MemberReceiveAddressServiceImpl extends ServiceImpl<MemberReceiveAddressDao, MemberReceiveAddressEntity> implements MemberReceiveAddressService {

  @Override
  public PageUtils queryPage(Map<String, Object> params) {
    IPage<MemberReceiveAddressEntity> page = this.page(
      new Query<MemberReceiveAddressEntity>().getPage(params),
      new QueryWrapper<MemberReceiveAddressEntity>()
    );

    return new PageUtils(page);
  }

  @Override
  public List<MemberReceiveAddressEntity> getAddress(Long memberId) {
    return this.list(new QueryWrapper<MemberReceiveAddressEntity>().eq("member_id", memberId));
  }

}
